/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.anhdt.model;

import com.anhdt.dao.CategoriesDAO;
import com.anhdt.dao.TopicDAO;
import com.anhdt.vo.TopicVO;
import java.sql.SQLException;
import java.util.List;


public class Menu {
    private static Menu Menu;
   
   private Menu(){
   }
   
   public static Menu getInstance() {
        if (Menu == null) {
            Menu = new Menu();
        }
        return Menu;
    }
    public List<TopicVO> getMenu() throws SQLException{
        TopicDAO tpDAO = TopicDAO.getInstance();
        List<TopicVO> list = tpDAO.getAllTopic();
        for (TopicVO topic : list) {
            CategoriesDAO cateDao = CategoriesDAO.getInstance();
            topic.setListCate(cateDao.getListCateByTopic(topic.getId()));
        }   
        return list;
    }
    
}
